package com.java46.service;

import com.java46.bean.Bespeak;
import com.java46.exception.MyException;
import com.java46.mapper.BespeakMapper;
import com.java46.util.ServiceUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class ReceptionBespeakService {
    /**
     * 从spring里拿到mapper接口
     */
    private BespeakMapper bespeakMapper;

    /**
     * 查询所有预约
     * @return
     * @throws MyException
     */
    public List<Bespeak> getAllBespeak() throws MyException {
        List<Bespeak> bespeaks;
        bespeaks = bespeakMapper.selectAll();
        ServiceUtil.checkNull(bespeaks,"没有查到数据");

        return bespeaks;
    }
}
